
#ifndef _MEMBER_BCAMERA_H_
#define _MEMBER_BCAMERA_H_

#include <BMap>
#include <BPlane>
#include <BImage>
#include <BNode>
#include <BLight>
#include <BScene>
#include <BCamera>
#include <BHandler>
#include "IPixmap.h"
#include "IFrustum.h"

#define camera_member(camera)		((member_BCamera*)((BCamera*)camera)->_ptr)

namespace BWE
{
	class ShapeInfo
	{
	public:
		ShapeInfo()
		{
			node = 0;
			shape = 0;
		}

		BBox		box;
		BNode*		node;
		BShape*		shape;
	};
	typedef BArray<ShapeInfo>		ShapeInfoArray;
	typedef BMap<float, ShapeInfo>	ShapeInfoQueue;

	class member_BCamera
	{
	public:
		member_BCamera(BCamera* camera);
		~member_BCamera();

		void adjust();

		void updateFrustum();
		void prepareShapes();

		void frame(BScene* scene, BHandler* handler = 0);
		void renderHandler(BHandler* handler, BRender& render);

		BCamera*			boss;
		bool				ortho;
		BVector				center;
		BVector				up;
		double				left;
		double				right;
		double				top;
		double				bottom;
		double				fovy;
		double				aspect;
		double				near;
		double				far;

		bool				culling;
		IFrustum			frustum;

		BImageHolder		photoImage;
		IPixmapHolder		pixmap;
		BScene*				scene;
		BArray<BLight*>		lights;
		ShapeInfoArray		shapeArray;
		ShapeInfoQueue		transShapeQueue;
		bool				refresh;
	};
}

#endif
